Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
变更说明
本次修复针对 Codex / OpenAI Responses 场景中,偶发返回上一轮提问回答的问题。
核心原因是 OpenAI 会话锚点优先级过于偏向 session_id,当客户端在同一个稳定 session_id 下切换到新的 conversation_id 时,服务端仍可能复用旧的会话状态、旧的 turn state 或旧的上游续链锚点,导致新问题被错误续接到旧对话。
修复内容
验证结果
已在本地通过以下测试:
�ash go test ./internal/service go test ./internal/handler影响范围
主要影响 OpenAI 相关的会话锚点选择逻辑,不改变正常请求的业务语义;
修复后在存在 conversation_id 的情况下,会更保守地按对话粒度隔离状态,降低新问题误续到旧对话的概率。